import { findAllCategory } from '@/api/category'
import constants from '@/api/constants'
export default {
  namespaced: true,
  state: {
    //默认的分类列表
    cateList: constants.map(v => {
      return { name: v }
    })
  },
  mutations: {
    setCateList (state, playload) {
      state.cateList = playload
    }
  },

  actions: {
    async getCateList (context) {
      let res = await findAllCategory()
      console.log(res)
      context.commit('setCateList', res.result)
    }
  }
}
